/**
 * 2017年12月14日
 */
package exp.paper;

import exp.algorithm.WrapperClassifier;
import exp.paper.api.FeatureTransformer;
import weka.classifiers.Classifier;
import weka.classifiers.bayes.NaiveBayes;
import weka.core.Instance;
import weka.core.Instances;

/**
 * 3.5
 * @author Alex
 *
 */
public class Flow extends WrapperClassifier{
	private static final long serialVersionUID = -3611439828491669986L;
	FeatureTransformer transformer = null;
	public Flow(FeatureTransformer ftf) {
		this(ftf,new NaiveBayes());
	}
	public Flow(FeatureTransformer ftf,Classifier c) {
		super(c);
		this.transformer = ftf;
	}
	public void setTransformer(FeatureTransformer transformer) {
		this.transformer = transformer;
	}
	
	@Override
	public void buildClassifier(Instances data) throws Exception {
		
		super.buildClassifier(transformer.transformInstances(data));
	}
	@Override
	public double[] distributionForInstance(Instance ins) throws Exception {
		return super.distributionForInstance(transformer.transformInstance(ins));
	}
	
}
